<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>

<script>
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{ //test for MSIE x.x;
		alert(navigator.userAgent);
		var ieversion = Number(RegExp.$1); // capture x.x portion and store as a number
		var subversion = Number(RegExp.$2);
		if (ieversion >= 8)
			document.write(ieversion + "." + subversion + " 您的浏览器版本为IE8或者以上");
		else if (ieversion >= 7)
			document.write(ieversion + "." + subversion + " 您的浏览器版本为IE7.x");
		else if (ieversion >= 6)
			document.write(ieversion + "." + subversion + " 您的浏览器版本为IE6.x");
		else if (ieversion >= 5)
			document.write(ieversion + "." + subversion + " 您的浏览器版本为IE5.x");
	}
	else
		document.write("未知IE版本");

</script>
</body>
</html>